﻿using System;
using System.Collections.Generic;
using System.Text;

namespace OOP
{
    class GenericDemo1
    {
        //static void Main(string[] args)
        //{
        //    //泛型
        //    Apple apple = new Apple() { Color = "红色" };
        //    Book book = new Book() { Name = "C#入门到放弃" };
        //    Box<Apple> box1 = new Box<Apple>() { Cargo = apple };
        //    Box<Book> box2 = new Box<Book>() { Cargo = book };

        //    Console.WriteLine(box1.Cargo.Color);
        //    Console.WriteLine(box2.Cargo.Name);
        //}
    }

    class Book
    {
        public string Name { get; set; }
    }
    class Apple
    {
        public string Color{ get; set; }
    }

    class Box<TCargo>
    {
        public TCargo Cargo { get; set;}

    }

}
